<template>
  <div class="Setting-box">
    <div class="box">
      <div class="StartTitle">路径</div>
      <div class="path-box">
        <div>路径设置:<input class="input-line" type="text" v-model="filePath" /></div>
        <input class="input-button" type="file" @change="handleFileChange" />
      </div>
    </div>
  </div>
</template>

<script setup>
import './Setting_1.css'
import { ref } from 'vue'

// 定义一个响应式变量 filePath，用于存储文件路径
const filePath = ref('')
let path = null

// 处理文件选择事件
const handleFileChange = (event) => {
  const file = event.target.files[0]
  // 显示虚拟路径
  filePath.value = file.path
}

// 获取主进程变量中的路径，并设置为 filePath 的初始值
window.electron.getMainProcessVariable().then(async (mainProcessVariable) => {
  path = mainProcessVariable.path + '\\'
  filePath.value = path
})
</script>
